home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / guide / html-hea.lha / ARexx / HTML-SE.rexx < prev    next >
OS/2 REXX Batch file  |  1995-04-12  |  2KB  |  52 lines

  1. /* HTML-Helper Arexx script for SAS-C's SE (Stream Editor)
  2.  * Ver      : 0.9 (28th November 1994)
  3.  * Copyright: Paul Kolenbrander (InterNet: paul@serena.iaehv.nl)
  4.  * Function : Pass on the HTML commands from HTML-Helper to SE.
  5.  * Input    : HTMLCMD - The HTML command to be inserted.
  6. */
  7.  
  8. OPTIONS RESULTS                                /* enable return codes      */
  9. PARSE ARG HTMLCMD
  10.  
  11. HTMLCMD = SUBSTR(HTMLCMD,2, LENGTH(HTMLCMD)-2) /* strip leading/trailing " */
  12.  
  13. posit=1                                        /* replace all '"' by '\"'  */
  14. NEWSTRING=""                                   /* as SE eats the '"'. :-(  */ 
  15. max=LENGTH(HTMLCMD)
  16. DO UNTIL posit = max
  17.    IF SUBSTR(HTMLCMD,posit,1) = '"' THEN
  18.       NEWSTRING = NEWSTRING || '\'
  19.    NEWSTRING = NEWSTRING || SUBSTR(HTMLCMD,posit,1)
  20.    posit=posit+1
  21. END  
  22. NEWSTRING = NEWSTRING || SUBSTR(HTMLCMD,LENGTH(HTMLCMD),1)
  23. HTMLCMD=NEWSTRING
  24.  
  25. address 'SC_SE'                                /* SE's ARexx port          */ 
  26.  
  27. IF POS('><',HTMLCMD) ~= 0 THEN DO              /* Is it a split command?   */
  28.                                                /* If yes, then....         */
  29.    'BM "E"'                                    /* Get Block end position   */
  30.    options results
  31.    'GL'                                        /* get the line number      */
  32.    end = result
  33.    'LL "'|| end ||'\n"'                        /* Move to end of block     */
  34.    'NL'
  35.    'BL'
  36.    CMD2 = right(HTMLCMD,(LENGTH(HTMLCMD)-(LASTPOS('<',HTMLCMD))+1))
  37.    'IL' CMD2                                   /* insert the back tag      */
  38.  
  39.    'BM "B"'                                    /* Get Block start position */
  40.    options results
  41.    'GL'                                        /* get the line number      */
  42.    begin = result
  43.    'LL "'|| begin ||'\n"'                      /* Move to start of block   */
  44.    CMD1 = substr(HTMLCMD,1,(LENGTH(HTMLCMD)-LENGTH(CMD2)))
  45.    'BL'
  46.    'IL' CMD1                                   /* insert the front tag     */
  47. END
  48. ELSE   
  49. 'IL' HTMLCMD                                   /* Insert at current pos.   */
  50.  
  51. EXIT                                           /* And exit the script.     */
  52.